/*************************************************************************
    > File Name: list.cpp
    > Author: cl007
    > Mail: cl007@126.com 
    > Created Time: 2016年09月21日 星期三 11时15分45秒
 ************************************************************************/

#include<iostream>
#include<string>
#include<list>

using namespace std;

int main()
{
   list<string> l1;
   string str1 = "abcd";
   
   l1.assign(2, str1);
   
   cout << *l1.begin() << endl;
  
   list<string> l2(4, "hello");

   cout << l2.front()<< endl; 
   
   if(!l2.empty())
   {
       cout << "find" << endl;
   }

   cout << l2.size()<< endl;
   cout << l2.max_size() << endl;

   l2.push_back("come");
   l2.push_back("  ");
   l2.push_back("home");

   list<string>::iterator it;
  
   for(it = l2.begin(); it != l2.end(); it++)
   {
        cout <<" "<< *it;
   }
   cout << endl;
   
   list<string>::reverse_iterator rit;

   for(rit = l2.rbegin(); rit != l2.rend(); rit++ )
   {
        cout<<" "<< *rit;
   } 
   cout << endl;
   cout << l2.front() ;
   cout << l2.back();
  
  cout << endl; 
   l2.reverse();


   for(it = l2.begin(); it != l2.end(); it++)
   {
        cout <<" "<< *it;
   }

   l2.sort();

   cout << endl;
   
   for(it = l2.begin(); it != l2.end(); it++)
   {
        cout <<" "<< *it;
   }
  
   return 0;
}
